<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>DateUtil时间处理插件</title>
  <style>
    pre {
      font-size: 18px;
      word-wrap: break-word
    }

    .left,
    .right {
      display: inline-block;
      vertical-align: top;
    }

    .left span {
      color: #0094ff;
    }
  </style>
</head>

<body>
  <div id="box">
    <div class="left">

    </div>
    <div class="right">
      <pre>
          console.log(TD);
          // 获取星期一,默认当天
          console.log(TD.getMonday(2018, 11, 8));
          // 获取星期日,默认当天
          console.log(TD.getSunday(2018, 11, 8));
          // 获取某年某月第一天,默认当月
          console.log(TD.getFirstDay(2018, 11));
          // 获取某年某月最后一天,默认当月
          console.log(TD.getLastDay(2018, 11));
          // 任意一个月的天数,默认当月
          console.log(TD.getMonthDays(2018, 11));
          // 时间区间,天-时-分-秒
          console.log(TD.interval(new Date(2018, 11, 10, 0, 0), new Date(2018, 11, 10, 2, 15)));
          // 判断某天是星期几,默认当天
          console.log(TD.getWeek());
          console.log(TD.getWeek(2018, 11, 8));
          console.log(TD.getWeek(2018, 11, 8, '周'));
      </pre>
    </div>
  </div>

  <script src="./index.js"></script>
  <script>
    htmlShow()
    // setInterval(function () {
    //   TD.Date = new Date();
    //   htmlShow()
    // }, 1000)

    function htmlShow() {
      var html =
        `
    <p>日期对象: <span>${TD.Date}</span></p>
    <p>今年: <span>${TD.year}</span></p>
    <p>今月: <span>${TD.month}</span></p>
    <p>星期的某一天的数字: <span>${TD.day}</span></p>
    <p>月份的某一天: <span>${TD.date}</span></p>
    <p>日期对象格式化: <span>${TD.Date.Format('yyyy-MM-dd')}</span></p>
    <p>获取星期一,默认当天: <span>${TD.getMonday(2018, 11, 8)}</span></p>
    <p>获取星期日,默认当天: <span>${TD.getSunday(2018, 11, 8)}</span></p>
    <p>获取某年某月第一天,默认当月: <span>${TD.getFirstDay(2018, 11)}</span></p>
    <p>获取某年某月最后一天,默认当月: <span>${TD.getLastDay(2018, 11)}</span></p>
    <p>任意一个月的天数,默认当月: <span>${TD.getMonthDays(2018, 11)}</span></p>
    <p>时间区间,天-时-分-秒: <span>${JSON.stringify(TD.interval(new Date(2018, 11, 10, 0, 0), new Date(2018, 11, 10, 2, 15)))}</span></p>
    <p>判断某天是星期几,默认当天: <span>${TD.getWeek()}、</span><span>${TD.getWeek(2018, 11, 3, '周')}</span></p>
    `;
      document.getElementsByClassName('left')[0].innerHTML = html
    }
  </script>
</body>

</html>